<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
    <title>智能写作</title>
    <link rel="stylesheet" href="../../../css/mui.min.css" />
    <script src="../../../js/mui.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../../css/app.css" />
    <link rel="stylesheet" href="../../../npl/css/vant.mini.css" />
    <script src="../../../js/jquery-3.6.0.min.js"></script>
    <script src="../../../js/flexible.js"></script>
    <script src="../../../js/vue.js"></script>
    <script src="../../../js/sm2.js"></script>
    <script src="../../../js/sm3.js"></script>
    <script src="../../../js/clipboard.js"></script>
    <script src="../../../npl/js/vant.mini.js"></script>
    <script src="../../../js/vconsole.min.js"></script>
    <script src="../../text.js" type="text/javascript"></script>
    
    <script src="../js/util.js" type="text/javascript"></script>
    <script src="../js/multiBtn.js"></script>
    
    <style>
        img {
            pointer-events: none !important;
        }
        .img-div {
            display: flex;
            align-items: center;
        }
        .List {
            /* height: calc(100% - 3rem) !important;
            height: calc(100% - 3rem - constant(safe-area-inset-bottom));
            height: calc(100% - 3rem -env(safe-area-inset-bottom)); */
            /* border-radius: .2rem; */
            flex: 1;
            /* padding: 0 .5rem; */
            overflow-y: scroll;
            width: 100%;
            height: calc(100% - 2.2rem - 200px);
            /* padding-bottom: 0.5rem; */
        }
        .List .van-swipe-cell__right {
            display: flex;
        }
        .List .van-cell__left-icon {
            font-size: 46px;
            line-height: 46px;
            height: 46px;
        }
        .van-icon-search {
            margin-top: 5px;
            font-size: 20px !important;
        }
        .delete-button {
            height: 100%;
            background-color: #F83831;
            border: none;
        }

        .delete-button .van-button__content {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .delete-button .van-button__content .van-icon {
            font-size: 20px;
            margin-bottom: 4px;
            margin-left: 4px;
        }
        .van-search__content{
            background-color: #fff !important;
        }

        input[type=search] {
            background-color: #fff; /* 设置背景颜色为白色 */
            border-radius: 6px; /* 设置圆角边框，你可以根据需要调整这个值 */
            border: 1px solid #ebedf0; /* 示例：添加边框样式 */
        }

        .custom-col {
            height: 100px;
            place-items: center;
            display: grid;
        }

        .mb-2 {
            margin-bottom: 0.2rem;
        }

        .custom-col1 {
            height: 70px;
            width: 70px;
            border-radius: 6px;
            background: url(../images/gzfa.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .custom-col-txt {
            text-align: center;
            margin: 5px 0px;
            font-size: 14px;
            font-weight: bolder;
            height: 20px;
        }

        .custom-col2 {
            height: 70px;
            width: 70px;
            border-radius: 6px;
            background: url(../images/gzzj.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .custom-col3 {
            height: 70px;
            width: 70px;
            border-radius: 6px;
            background: url(../images/hytz.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .custom-col4 {
            height: 70px;
            width: 70px;
            border-radius: 6px;
            background: url(../images/hyjy.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .custom-col5 {
            height: 70px;
            width: 70px;
            border-radius: 6px;
            background: url(../images/gzbg.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .custom-col6 {
            height: 70px;
            width: 70px;
            border-radius: 6px;
            background: url(../images/xwg.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .text-col {
            width: 70px;
            text-align: center;
        }
        #app {
            background-color: #fff;
        }

        .searchBackGroud {
            height: 75px;
            width: 115px;
            background: url(../images/sstc.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }
        .search-item {
            margin: 0.3rem 0.3rem 0rem 0.3rem;    
            border-bottom: 1px solid #e6e8e9;
        }
        .search-item-in {
            color: #999;
            display: flex;
            align-items: center;
            line-height: 1rem;
        }
        .search-input {
            line-height: 0.8rem;
            height: 0.8rem;
            font-size: 0.3rem;
            border-radius: 25px;
            padding-left: 0.6rem;
            width: calc(100% - 1rem);
            border: 1px solid #e6e8e9;
        }
        .search-item input{
            border: 0px;
            margin-left: 0.1rem;
            width: calc(100% - 1rem);
        }
        .search-a {
            color:#9D9D9D;
            font-size: 0.3rem;
            margin-left: 0.1rem;
        }
        .search-a2 {
            font-size: 0.25rem;
            margin-left: 0.1rem;
            color: #000;
            font-weight: 600;
            line-height: 1.1rem;
            height: 1rem;
            flex-grow: 1;
        }
        .search-btn {
            height: 0.3rem;
        }
        .list-item {
            border-bottom: 1px solid #e6e8e9;
            height: 1.8rem;
            display: flex;
            margin: 0rem 0.4rem;
        }
        .list-item-l{
            width: 1.1rem;
            height: 1.8rem;
            line-height: 1.8rem;
            display: flex;
        }
        .list-item-r {
            padding-top: 0.1rem;
            width: calc(100% - 1.4rem);
        }
        .list-item-r2 {
            width: 0.1rem;
            display: flex;
            align-items: center;
            margin: auto;
        }
        .swipe-left {
            width: 0.1rem;
        }
        .img{
            height: 0.8rem;
            width: 0.7rem;
            margin: auto 0.2rem;
        }
        .title {
            padding-top: 0.4rem;
            font-weight: 600;
            font-size: 0.3rem;
            color: #2C2C2C;
            word-break: break-all;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        .desc {
            padding-top: 0.1rem;
            font-size: 0.25rem;
            color:#999;
        }
        .search-btn-l {
            position: absolute;
            left: 0.6rem;
            line-height: 0.8rem;
        }
        .search-btn-2 {
            margin-left: 0.5rem;
            height: 0.3rem;
        }
        .search-cancle {
            color: rgb(63, 100, 236);
            font-size: 0.3rem;
            margin-left: 0.2rem;
        }
        .search-row {
            margin: 0rem 0.4rem 0rem;
            border-bottom: 1px solid #e6e8e9;
        }
        .no-bottom {
            border-bottom: 0px;
        }
        ::-webkit-scrollbar{
            display: none;
        }

        .sheet-pop .van-share-sheet__header {
            padding: 15px 16px;
            border-bottom: 1px solid #ebedf0;
        }

        .sheet-pop .van-share-sheet__title {
            font-size: .37rem;
            color: #323233;
        }

        .sheet-pop .van-share-sheet__options {
            height: 4.5rem;
            display: flex;
            justify-content: flex-start;
            flex-wrap: wrap;
        }

        .sheet-pop .van-share-sheet__options .van-share-sheet__option:nth-child(-n+3) {
            margin-bottom: .4rem;
        }
        .sheet-pop .van-share-sheet__option {
            width: 25%;
        }
        .NamePop .van-popup--center {
            border-radius: 12px;
            width: 80%;
            padding: 20px 10px 10px;
            display: flex;
            justify-content: space-around;
            flex-direction: column;
            height: 25%;
        }
        .NamePop .van-cell {
            align-items: center;
            padding: 0 10px !important;
            background: none !important;
            justify-content: space-between;
        }
        .NamePop .form_btn {
            width: 100%;
            display: flex;
            padding: 0 5%;
            justify-content: space-between;
        }
        .NamePop .form_btn .van-button {
            width: 45%;
        }
        .NamePop .van-button__content {
            display: flex;
            flex-direction: column;
        }
        
    </style>
</head>
<body>
<div id="app" v-cloak>
    <multi-btn></multi-btn>
    <div class="is-loading">
        <div class="curtain">
            <div class="loadingBgc">
                <div class="loader"></div>
            </div>
        </div>
    </div>
    <div class="trainTickets" style="height: calc(100% - 20px)">
        <div class="header_tit">
            <van-nav-bar title="智能写作" left-arrow>
                <template #left>
                    <div class="back_l active-brightness" @click="home">
                        <img src="../../../image/left.png" alt="" />
                    </div>
                </template>
                <template #right>
                </template>
            </van-nav-bar>
        </div>
        <div style="padding: 0.2rem 0.4rem 0rem;">
            <van-row type="flex" justify="space-around">
                <van-col span="8" class="custom-col mb-2" @click="toWriteView('workProgram')">
                    <div class="custom-col1 active-brightness"></div>
                    <div class="custom-col-txt">工作方案</div>
                </van-col>
                <van-col span="8" class="custom-col mb-2" @click="toWriteView('workSummary')">
                    <div class="custom-col2 active-brightness"></div>
                    <div class="custom-col-txt">工作总结</div>
                </van-col>
                <van-col span="8" class="custom-col mb-2" @click="toWriteView('meetingNotice')">
                    <div class="custom-col3 active-brightness"></div>
                    <div class="custom-col-txt">会议通知</div>
                </van-col>
                <van-col span="8" class="custom-col" @click="toWriteView('meetingMinutes')">
                    <div class="custom-col4 active-brightness"></div>
                    <div class="custom-col-txt">会议纪要</div>
                </van-col>
                <van-col span="8" class="custom-col" @click="toWriteView('workReport')">
                    <div class="custom-col5 active-brightness"></div>
                    <div class="custom-col-txt">工作报告</div>
                </van-col>
                <van-col span="8" class="custom-col" @click="toWriteView('pressRelease')">
                    <div class="custom-col6 active-brightness"></div>
                    <div class="custom-col-txt">新闻稿</div>
                </van-col>
                <!-- <van-col span="5" class="">
                </van-col>
                <van-col span="5" class="">
                </van-col> -->
            </van-row>
            <!-- <van-row style="margin-top: 5px;font-size: 14px;font-weight: bolder;" type="flex" justify="space-around">
                <van-col span="5" class="text-col">
                    工作方案
                </van-col>
                <van-col span="5" class="text-col">
                    工作总结
                </van-col>
                <van-col span="5" class="text-col">
                    会议通知
                </van-col>
                <van-col span="5" class="text-col">
                    会议纪要
                </van-col>
                <van-col span="5" class="text-col">
                    会议纪要
                </van-col>
                <van-col span="5" class="text-col">
                    会议纪要
                </van-col>
            </van-row> -->
        </div>
        <div style="height: 100%;">
            <van-row :class="['search-row', isSearchFocused ? 'no-bottom' : '']">
                <div class="search-item-in active-brightness"  v-if="!showSearch">
                    <div class="search-a">我的文档</div>
                    <div class="search-a2">(仅保留30天文件)</div>
                    <!-- <input class="search-input" @keyup.enter="onSearch()" v-model="searchParams" placeholder="请输入搜索关键词"  v-if="showSearch" clearable @blur="showOrHide()"></input> -->
                    <div class="img-div active-brightness" @click="searchShow()">
                        <img class="search-btn" src="../images/write/search-btn.png"/>
                    </div>
                    <div class="img-div active-brightness" @click="deleteAllFiles()">
                        <img class="search-btn-2"  src="../images/qk.png" alt="" />
                    </div>
                </div>
                <div v-if="showSearch" style="line-height: 1rem;">
                    <van-icon name="search" class="search-btn-l"></van-icon>
                    <input v-if="showSearch" class="search-input" @keyup.enter="onSearch()" v-model="searchParams" placeholder="请输入..."></input>
                    <span @click="onCancel" class="search-cancle active-brightness">取消</span>
                </div>
            </van-row>

            <div v-if="isSearchFocused" style="display: flex;align-items: center;justify-content: center;width: 100%;margin-top: 50px;">
                <div class="searchBackGroud" >
                </div>
            </div>
            <div class="List" v-show="!isSearchFocused">
                <van-list
                        v-model="loading"
                        :finished="finished"
                        finished-text="没有更多了"
                        @load="onLoad">
                    <van-swipe-cell v-for="(item,index) in wordList" :key="index"
                        @open="openSwipe(item)" @close="closeSwipe(item)">
                        <div class="list-item active-brightness" @click="preview(item)">
                            <div class="list-item-l"><img class="img" src="../images/word.png"/></div>
                            <div class="list-item-r">
                                <div class="title">{{ item.name }}</div>
                                <div class="desc">{{ item.createTime }}</div>
                            </div>
                            <div class="list-item-r2" @click.stop="handleClickMore(item)">
                                <img class="swipe-left"  src="../../../image/more1.png" alt="" />
                            </div>
                        </div>
                        <!-- <template #right>
                            <van-button class="delete-button" @click="sendMail(item)" icon="../images/list-email.png" square text="发送" color="#4694fd">发送</van-button>
                            <van-button class="delete-button" @click="syncToInner(item)" icon="../images/list-sync.png" square text="同步" color="#f6ab00">同步</van-button>
                            <van-button class="delete-button" @click="share(item)" icon="../images/list-share.png" square text="分享" color="#00a096">分享</van-button>
                            <van-button class="delete-button" @click="delConfirm(item)" icon="../images/list-delete.png" square text="删除" color="#fc513f">删除</van-button>
                        </template> -->
                    </van-swipe-cell>
                </van-list>
                <van-share-sheet :options="options" v-model="showMore" 
                    class="sheet-pop"
                    cancel-text="" @select="onOptionSelect">
                    <template #title>
                        <div class="flex justify-between items-center w-full">
                            <span class="text-lg font-medium">更多操作</span>
                            <!-- 关闭按钮 -->
                            <van-icon style="position:absolute; top:15px;right:15px;" name="cross" size="18"
                                class="cursor-pointer" @click="showMore = false" />
                        </div>
                    </template>
                </van-share-sheet>
            </div>

            <!-- 显示重命名弹框 -->
            <div class="NamePop">
                <van-popup style="min-height: 4rem;" :close-on-click-overlay="false" v-model="showPopName">
                    <van-form>
                        <div style="text-align: center;font-size: 18px;font-weight:bold;margin-bottom: 10px;">重命名</div>
                        <van-field v-model="newTitleName" class="edit_title_input" placeholder="请输入标题" maxlength="100" />
                    </van-form>
                    <div class="form_btn">
                        <van-button type="default" size='10px' round @click="showPopName=false">取消</van-button>
                        <van-button type="primary" size='10px' color="#13C09B" round @click="reName">确定</van-button>
                    </div>
                </van-popup>
            </div>
        </div>
    </div>
</div>

<script>
    new Vue({
        el: '#app',
        data() {
            return {
                isflageIOX: true,
                searchWidth: 24,
                historytotal: 0,
                loading: false,
                isSearchFocused: false,
                finished: false,
                historyCurrent: 1,
                searchParams: "",
                clipboard: {
                    content: "",
                },
                wordList: [
                ],
                showSearch: false,

                currentItem: null,
                showMore: false, //展开按钮
                options: [{
                        id: 1,
                        name: '发送邮箱',
                        icon: '../../../image/voiceSend.png'
                    },
                    {
                        id: 2,
                        name: '同步内网网站',
                        icon: '../../../image/voiceTb.png'
                    },
                    {
                        id: 3,
                        name: '分享到i国网',
                        icon: '../../../image/voiceJ.png'
                    },
                    {
                        id: 4,
                        name: '重命名',
                        icon: '../../../image/voiceC.png'
                    },
                    {
                        id: 5,
                        name: '删除',
                        icon: '../../../image/voiceD.png'
                    },
                    {
                        id: 6,
                        name: '预览',
                        icon: '../../../image/voiceL.png'
                    },
                ],
                newTitleName: '',
                showPopName: false
            }
        },
        watch: {

        },
        created() {
            const _this = this
            let jsApiList = []
            $.getScript("../../../js/jweixin-sgccigw-1.0.0.js" /*"js/jweixin-1.0.0.js"*/, function () {
                'use strict';
                wx.ready(function () {
                    wx.onHistoryBack(() => {
                        _this.home()
                        return false
                    })
                });
                jsApiList = [
                    'previewFile',
                    'onHistoryBack',
                    // 'agentConfig',
                    // 'selectEnterpriseContact'
                ];
                // wx.ready(function() {
                // wx.invoke("agentConfig", {
                //         agentid: '1003505', 
                //         corpid: 'ww4d11a39991ebffdc',
                //         timestamp: 1639582452,
                //         nonceStr: 'AMQGnmTMzhJetshY',
                //         signature: 'fb9f560a9b4824f7db3525926994010de74ea055',
                //         jsApiList: jsApiList
                //     }, function(data) {
                //         console.log(data,"agentConfig")
                //         if(data.err_msg == "agentConfig:ok"){
                //             wx.invoke('getAuthCode', {
                //                 response_type: 'code',//固定参数
                //                 scope: 'snsapi_base'//固定参数
                //             }, function (res) {
                //                 if(res.err_msg == "getAuthCode:ok"){
                //                 //   iscp_ready(res.code)
                //                 }else{
                //                 //   $("#showP").html("获取用户信息失败")
                //                 }
                //             })
                //         }
                //     });
                // });
                wx.config({
                    beta: true, // 调用wx.invoke形式的接口值时，该值必须为true。
                    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                    appId: corpid,
                    timestamp: '1626832073',
                    nonceStr: nonceStr,
                    signature: signature,
                    jsApiList: jsApiList
                });
            });
        },
        mounted() {
            console.log("-------调试")
            this.compatibleInput()
            this.queryList()
        },
        methods: {
            preview(item) {
                myPreviewFile(item)
            },
            //显示搜索框或者直接搜索
            searchShow(){
                this.showSearch = true;
                this.isSearchFocused = true;
            },
            queryList() {
                const userId = sessionStorage.getItem("userId");
                let param = {
                    "userId": userId,
                    "keyWord": this.searchParams,
                    "current": this.historyCurrent,
                    "size": 20,
                    "timestamp": new Date().getTime() + "",
                };
                let AuthenticationSession = sessionStorage.getItem("Authentication");
                data = JSON.stringify(param)
                let sign = sm3(data);
                $.ajax({
                    url: localUrlLink + iscp_port + "/tjAiAssistant/writing/queryList",
                    type: "post",
                    async: false, //是否同步，false表示同步请求
                    dataType: "json",
                    data: data,
                    headers: {
                        "Content-Type": "application/json;charset=UTF-8",
                        Authentication: AuthenticationSession,
                        sign: sign
                    },
                    success: (res, txt, xhr) => {
                        if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                            let Authentication = xhr.getResponseHeader("Authentication")
                            if (res.code == 200) {
                                if (Authentication) {
                                    sessionStorage.setItem("Authentication", Authentication);
                                }
                                this.historytotal = res.resultValue.total
                                res.resultValue.list.forEach((item) => {
                                    this.$set(item, 'showSwipeLeft', true)
                                    this.wordList.push(item)
                                })
                                if (this.historytotal == 0) {
                                    this.finished = true;
                                }
                                if (res.resultValue.list.length < 20) {
                                    this.finished = true;
                                }
                                this.loading = false;
                                this.onCancel()
                            } else {
                                mui.toast('请稍后再试', {
                                    duration: 1000,
                                    type: 'div'
                                })
                            }
                        }
                    },
                    error: (e) => {
                        $(".curtain").css("display", "none");
                        mui.toast('请稍后再试', {
                            duration: 1000,
                            type: 'div'
                        })
                    },
                });
            },
            delConfirm(item) {
                var btnArray = ["取消", "确定"];
                var i = 0;
                mui.confirm("删除文件后不可恢复", "删除文件", btnArray, (e) => {
                    if (i > 0) return;
                    i++;
                    if (e.index == 1) {
                        $(".curtain").css("display", "block");
                        const userId = sessionStorage.getItem("userId");
                        let param = {
                            "userId": userId,
                            "id": item.writingId,
                            "timestamp": new Date().getTime() + "",
                        };
                        let AuthenticationSession = sessionStorage.getItem("Authentication");
                        data = JSON.stringify(param)
                        let sign = sm3(data);
                        $.ajax({
                            url: localUrlLink + iscp_port + "/tjAiAssistant/writing/delete",
                            type: "post",
                            async: false, //是否同步，false表示同步请求
                            dataType: "json",
                            data: data,
                            headers: {
                                "Content-Type": "application/json;charset=UTF-8",
                                Authentication: AuthenticationSession,
                                sign: sign
                            },
                            success: (res, txt, xhr) => {
                                $(".curtain").css("display", "none");
                                if (res.code == 200) {
                                    this.wordList = []
                                    this.historyCurrent = 1
                                    this.queryList()
                                } else {
                                    mui.toast('请稍后再试', {
                                        duration: 1000,
                                        type: 'div'
                                    })
                                }
                            },
                            error: (e) => {
                                $(".curtain").css("display", "none");
                                mui.toast('请稍后再试', {
                                    duration: 1000,
                                    type: 'div'
                                })
                            },
                        });
                    } else {

                    }
                });
            },
            toWriteView(type) {
            //     wx.invoke("selectEnterpriseContact", {
            //         "fromDepartmentId": -1,// 必填，-1表示打开的通讯录从自己所在部门开始展示, 0表示从最上层开始
            //         "mode": "multi",// 必填，选择模式，single表示单选，multi表示多选
            //         "type": ["department", "user"],// 必填，选择限制类型，指定department、user中的一个或者多个
            //         // "selectedDepartmentIds": ["2","3"],// 非必填，已选部门ID列表。用于多次选人时可重入
            //         // "selectedUserIds": ["lisi","lisi2"]// 非必填，已选用户ID列表。用于多次选人时可重入
            //     },function(res){
            //         console.log("selectEnterpriseContact", res)
            //         if (res.err_msg == "selectEnterpriseContact:ok")
            //         {
                        
            //             if(typeof res.result == 'string')
            //             {
            //                 res.result = JSON.parse(res.result) //由于目前各个终端尚未完全兼容，需要开发者额外判断result类型以保证在各个终端的兼容性
            //             }
            //             var selectedDepartmentList = res.result.departmentList;// 已选的部门列表
            //             for (var i = 0; i < selectedDepartmentList.length; i++)
            //             {
            //                 var department = selectedDepartmentList[i];
            //                 var departmentId = department.id;// 已选的单个部门ID
            //                 var departemntName = department.name;// 已选的单个部门名称
            //             }
            //             var selectedUserList = res.result.userList; // 已选的成员列表
            //             for (var i = 0; i < selectedUserList.length; i++)
            //             {
            //                 var user = selectedUserList[i];
            //                 var userId = user.id; // 已选的单个成员ID
            //                 var userName = user.name;// 已选的单个成员名称
            //                 var userAvatar= user.avatar;// 已选的单个成员头像
            //             }
            //         }
            //     }
            // );
                $(location).attr("href", "./"+type+".html");
            },
            handleFocus() {
                this.isSearchFocused = true;
                this.searchWidth = 20;
                console.log("isSearchFocused",this.isSearchFocused);
            },
            handleBlur() {
                this.isSearchFocused = false;
                this.searchWidth = 24;
                console.log("isSearchFocused",this.isSearchFocused);
            },
            onSearch() {
                this.wordList = [];
                this.historyCurrent = 1;
                this.queryList();
                // this.searchParams = '';
            },
            onCancel() {
                this.searchParams = '';
                this.showSearch = false;
                this.isSearchFocused = false;
                this.searchWidth = 24;
            },
            onLoad() {
                if (!this.historyCurrent === 0) {
                    this.finished = this.wordList.length >= this.historytotal;

                }
                if (!this.finished) {
                    this.historyCurrent = this.historyCurrent + 1;
                    this.queryList();
                }
            },
            //复制按钮
            copy() {
                let text1 = this.clipboard.content;
                var clipboard = new Clipboard(".tag-read", {
                    // 通过target指定要复印的节点
                    text: function () {
                        return text1;
                    },
                });
                clipboard.on("success", (e) => {
                    addOperator(2, 11, "复制文本", 1, 1, "复制成功");
                    mui.toast("复制成功", {
                        duration: "long",
                        type: "div"
                    });
                });
                clipboard.on("error", (e) => {
                    addOperator(2, 11, "复制文本", 1, 0, "复制失败");
                });
            },
            //分享
            share(result) {
                if(!result.id) {
                    return
                }
                if(1 == result.writingType) {
                    shareIgw({sceneNo: '102',shareType: 1,attchId: result.id})
                }else if(2 == result.writingType) {
                    shareIgw({sceneNo: '103',shareType: 1,attchId: result.id})
                }else if(3 == result.writingType) {
                    shareIgw({sceneNo: '104',shareType: 1,attchId: result.id})
                }else if(4 == result.writingType) {
                    shareIgw({sceneNo: '105',shareType: 1,attchId: result.id})
                }else if(5 == result.writingType) {
                    shareIgw({sceneNo: '106',shareType: 1,attchId: result.id})
                }else if(6 == result.writingType) {
                    shareIgw({sceneNo: '117',shareType: 1,attchId: result.id})
                }else if(7 == result.writingType) {
                    shareIgw({sceneNo: '118',shareType: 1,attchId: result.id})
                }
            },
            //发送邮件
            sendMail(result) {
                if(!result.id) {
                    return
                }
                if(1 == result.writingType) {
                    mySendMail('工作方案', "answerAttach="+result.id, 10, 2)
                }else if(2 == result.writingType) {
                    mySendMail('工作总结', "answerAttach="+result.id, 10, 3)
                }else if(3 == result.writingType) {
                    mySendMail('会议通知', "answerAttach="+result.id, 10, 4)
                }else if(4 == result.writingType) {
                    mySendMail('会议纪要', "answerAttach="+result.id, 10, 5)
                }else if(5 == result.writingType) {
                    mySendMail('会议助手', "answerAttach="+result.id, 10, 6)
                }else if(6 == result.writingType) {
                    mySendMail('新闻稿', "answerAttach="+result.id, 11, 7)
                }else if(7 == result.writingType) {
                    mySendMail('工作报告', "answerAttach="+result.id, 11, 8)
                }
            },
            //发送到内网统一入口
            syncToInner(result) {
                if(1 == result.writingType) {
                    mySyncToInner('工作方案', "answerAttach="+result.id, 10, 2)
                }else if(2 == result.writingType) {
                    mySyncToInner('工作总结', "answerAttach="+result.id, 10, 3)
                }else if(3 == result.writingType) {
                    mySyncToInner('会议通知', "answerAttach="+result.id, 10, 4)
                }else if(4 == result.writingType) {
                    mySyncToInner('会议纪要', "answerAttach="+result.id, 10, 5)
                }else if(5 == result.writingType) {
                    mySyncToInner('会议助手', "answerAttach="+result.id, 10, 6)
                }else if(6 == result.writingType) {
                    mySyncToInner('新闻稿', "answerAttach="+result.id, 11, 7)
                }else if(7 == result.writingType) {
                    mySyncToInner('工作报告', "answerAttach="+result.id, 11, 8)
                }
            },
            deleteAllFiles() {
                var btnArray = ["取消", "确定"];
                var i = 0;
                mui.confirm("清空历史对话记录", "清空文件", btnArray, (e) => {
                    if (i > 0) return;
                    i++;
                    if (e.index == 1) {
                        $(".curtain").css("display", "block");
                        const userId = sessionStorage.getItem("userId");
                        let param = {
                            "userId":userId,
                            "timestamp": new Date().getTime() + "",
                        }
                        let AuthenticationSession = sessionStorage.getItem("Authentication");
                        data = JSON.stringify(param)
                        let sign = sm3(data);
                        $.ajax({
                            url: localUrlLink + iscp_port + "/tjAiAssistant/writing/deleteAllWork",
                            type: "post",
                            async: false, //是否同步，false表示同步请求
                            dataType: "json",
                            data: data,
                            headers: {
                                "Content-Type": "application/json;charset=UTF-8",
                                Authentication: AuthenticationSession,
                                sign: sign
                            },
                            success: (res, txt, xhr) => {
                                if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                                    let Authentication = xhr.getResponseHeader("Authentication")
                                    if (res.code == 200) {
                                        if (Authentication) {
                                            sessionStorage.setItem("Authentication", Authentication);
                                        }
                                        this.wordList = []
                                    } else {
                                        mui.toast('请稍后再试', {
                                            duration: 1000,
                                            type: 'div'
                                        })
                                    }
                                }
                                $(".curtain").css("display", "none");
                            },
                            error: (e) => {
                                $(".curtain").css("display", "none");
                                mui.toast('请稍后再试', {
                                    duration: 1000,
                                    type: 'div'
                                })
                            },
                        });
                    } else {
                    }
                });
            },
            openSwipe(item) {
                this.$set(item, 'showSwipeLeft', false)
            },
            closeSwipe(item) {
                this.$set(item, 'showSwipeLeft', true)
            },
            handleClickMore(item) {
                this.currentItem = item
                this.showMore = true
            },
            handleRename(item) {
                this.showPopName = true
                let titleName = this.currentItem.name.substr(0, this.currentItem.name.indexOf(".docx"))
                this.newTitleName = titleName
            },
            reName(item) {
                $(".curtain").css("display", "block");
                const userId = sessionStorage.getItem("userId");
                let param = {
                    "userId":userId,
                    "id": this.currentItem.id,
                    "newName": this.newTitleName,
                    "timestamp": new Date().getTime() + "",
                }
                let AuthenticationSession = sessionStorage.getItem("Authentication");
                data = JSON.stringify(param)
                let sign = sm3(data);
                $.ajax({
                    url: localUrlLink + iscp_port + "/tjAiAssistant/common/renameFile",
                    type: "post",
                    async: false, //是否同步，false表示同步请求
                    dataType: "json",
                    data: data,
                    headers: {
                        "Content-Type": "application/json;charset=UTF-8",
                        Authentication: AuthenticationSession,
                        sign: sign
                    },
                    success: (res, txt, xhr) => {
                        if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                            let Authentication = xhr.getResponseHeader("Authentication")
                            if (res.code == 200) {
                                if (Authentication) {
                                    sessionStorage.setItem("Authentication", Authentication);
                                }
                                this.$set(this.currentItem, 'name', this.newTitleName + this.currentItem.suffix)
                                this.showPopName = false
                                mui.toast('修改成功', {
                                    duration: 1000,
                                    type: 'div'
                                })
                            } else {
                                mui.toast('请稍后再试', {
                                    duration: 1000,
                                    type: 'div'
                                })
                            }
                        }
                        $(".curtain").css("display", "none");
                    },
                    error: (e) => {
                        $(".curtain").css("display", "none");
                        mui.toast('请稍后再试', {
                            duration: 1000,
                            type: 'div'
                        })
                    },
                });
            },
            onOptionSelect(option) {
                this.showMore = false
                if(1 == option.id) {
                    this.sendMail(this.currentItem)
                }else if(2 == option.id) {
                    this.syncToInner(this.currentItem)
                }else if(3 == option.id) {
                    this.share(this.currentItem)
                }else if(4 == option.id) {
                    this.handleRename(this.currentItem)
                }else if(5 == option.id) {
                    this.delConfirm(this.currentItem)
                }else if(6 == option.id) {
                    this.preview(this.currentItem)
                }
            },
            // 判断安卓还是ios
            compatibleInput() {
                //获取浏览器的userAgent,并转化为小写
                var ua = navigator.userAgent.toLowerCase();
                //判断是否是苹果手机，是则是true
                var isIos = ua.indexOf("iphone") != -1 || ua.indexOf("ipad") != -1;
                if (isIos) {
                    this.isflageIOX = true;
                } else {
                    this.isflageIOX = false;
                }
            },
            home() {
                $(location).attr("href", "../../Home.html");
            },
            createSgin(data) {
                let hashData = sm3(data);
                let hashData_last = sm3(hashData);
                hashData_last = hashData_last.substr(0, 5);
                hashData += hashData_last;
                let sign = hashData;
                return sign;
            },
        }
    })
</script>
</body>
</html>